package com.right.health.app.ui.common;

import android.os.Bundle;
import android.widget.GridView;

import com.magic.basic.activity.BaseActivity;
import com.magic.basic.utils.ToastUtil;
import com.right.health.app.R;
import com.right.health.app.app.App;
import com.right.health.app.bean.HomeItem;
import com.right.health.app.common.DataCommon;
import com.right.health.app.ui.main.MainActivity;
import com.right.health.app.ui.main.adapter.HomeFeature1Adapter;

/*
 * Created by hopeliao on 2019-09-26
 *
 */
public class MoreServiceActivity extends BaseActivity {

    private HomeFeature1Adapter mAdapter;

    @Override
    public void onCreate(Bundle bundle, String s) {
        setContentView(R.layout.more_service);
    }

    @Override
    public void findView() {
        GridView gridView = (GridView) findViewById(R.id.gridview);
        mAdapter = new HomeFeature1Adapter(this);
        gridView.setAdapter(mAdapter);
        gridView.setOnItemClickListener((parent, view, position, id) -> {
            HomeItem homeItem = (HomeItem) parent.getItemAtPosition(position);
            if (homeItem != null) {
                if ("病历查询".equals(homeItem.name)) {
                    MainActivity.makeActivity(MoreServiceActivity.this, MainActivity.TAB_MEDICAL);
                    finish();
                } else {
                    ToastUtil.show(App.getInstance(), R.string.not_yet_opened);
                }
            }
        });
    }

    @Override
    public void initialize() {
        mAdapter.setDataSource(DataCommon.getMoreService());
    }
}
